<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$return['pluginset']=$basic=$this->plugin_setting('setting');
if($_RQ['op']=='main'){
		$return['category']=pdo_getall('jy_sns_category',array('uniacid'=>$_SESSION['uniacid'],'enabled'=>1,'isnoshow'=>0),'','','displayorder desc');
		$return['list']=array();
		$return['params']=array('type'=>0,'cid'=>intval($_RQ['cid']));
		$return['sharedata']=array(
			'title'=>$basic['share_title']?$basic['share_title']:'论坛板块',
			'desc'=>$basic['share_desc'],
			'link'=>custom_url('jy_sns/board.lists//cid='.$_RQ['cid'],true),
			'imgUrl'=>ATTACHMENT_URL.$basic['share_icon'],
		);
		set_html('title','论坛板块');
		exi($return);
}
if($_RQ['op']=='rec'){
		$return['category']=pdo_getall('jy_sns_category',array('uniacid'=>$_SESSION['uniacid'],'enabled'=>1,'isnoshow'=>0),'','','displayorder desc');
		$return['list']=pdo_getall('jy_sns_board',array('uniacid'=>$_SESSION['uniacid'],'enabled'=>1,'isrecommand'=>1));
		foreach($return['list'] as &$v){
			$v['postcount']=getPostCount($v['id']);
			$v['followcount']=getFollowCount($v['id']);
		}
		exi($return);
}
if($_RQ['op']=='cate'){
		$return['category']=pdo_getall('jy_sns_category',array('uniacid'=>$_SESSION['uniacid'],'enabled'=>1,'isnoshow'=>0),'','','displayorder desc');
		$return['list']=array();
		$return['params']=array('type'=>0,'cid'=>intval($_RQ['cid']));
		exi($return);
}
if($_RQ['op']=='getlist'){
		$params=array('uniacid'=>$_SESSION['uniacid'],'enabled'=>1);
		if($_RQ['cid']){
			$params['cid']=$_RQ['cid'];
		}
		if($_RQ['isrecommand']){
			$params['isrecommand']=1;
		}
		$return['list']=pdo_getall('jy_sns_board',$params,'','','displayorder desc');
		foreach($return['list'] as &$v){
			$v['postcount']=getPostCount($v['id']);
			$v['followcount']=getFollowCount($v['id']);
		}
		exi($return);
}
?>